home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Creative Review 28
/
Creative-Review-CD-ROM-28.iso
/
pc
/
kungfu
/
assets
/
game.dir
/
00033_Script_anim class
< prev
next >
Wrap
Text File
|
1997-08-08
|
8KB
|
338 lines
-- anim class
-- -----------------------------------------------------------------------------
property ancestor
property anim
property animcount
property drawlist
property drawcount
property animflag
property hideflag
property framenumber
property max
property master
property gap
property callback
-- property timetest
-- =============================================================================
global gtime, gspeed
-- =============================================================================
-- new method
-- -----------------------------------------------------------------------------
on new me, props
mInit me, props
return me
end new
-- =============================================================================
-- minit method
-- -----------------------------------------------------------------------------
on minit me, props
-- put "in minit anim"
set master = getaprop ( props, #master )
set max = getaprop ( props, #max )
set anim = getaprop ( props, #anim )
set animcount = count ( anim )
set hideflag = false
set framenumber = 0
-- set timetest = new ( script "time test class" )
-- put "out minit anim"
end minit
-- =============================================================================
-- msetdraw method
-- -----------------------------------------------------------------------------
on msetdraw me, draws
-- put "in msetdraw"
set drawlist = draws
if max > count ( drawlist ) then put "** not enough draws for anim **"
set ancestor = getat ( drawlist, master )
set drawcount = count ( drawlist )
-- put "out msetdraw"
end msetdraw
-- =============================================================================
-- mstart method
-- -----------------------------------------------------------------------------
on mstart me, thecallback
msetoffset me, point ( 0, 0 )
set framenumber = 0
set callback = thecallback
set animflag = true
maddtask gtime, me, the timer
-- put "out start anim class"
end mstart me
-- =============================================================================
-- mdispose method
-- -----------------------------------------------------------------------------
on mdispose me
put "in mdispose anim class"
set anim = 0
set ancestor = 0
set callback = 0
mdeletetasks gtime, me
put "in mdispose anim class"
end mdispose me
-- =============================================================================
-- finish method
-- -----------------------------------------------------------------------------
on mfinish me
-- put "in finish anim"
set animflag = false
if hideflag then
-- put "hiding at mfinish anim"
mhide ( me )
end if
set thecallback = callback
set callback = 0
if objectp ( thecallback ) then manimfinish ( thecallback , me )
-- put "out finish anim"
end mfinish
-- =============================================================================
-- mdotask method
-- -----------------------------------------------------------------------------
on mdotask me
-- put "in mdotask anim"
return manimate ( me )
-- put "out mdotask anim"
end mdotask
-- =============================================================================
-- mabort method
-- -----------------------------------------------------------------------------
on mabort me
-- put "in mabort anim class :" , me
set callback = false
mfinish me
mhide me
mdeletetasks gtime, me
-- put "out mabort anim class :" , me
end mstop me
-- =============================================================================
-- manimate method
-- -----------------------------------------------------------------------------
on manimate me
-- put "in manimate anim"
set framenumber = framenumber + 1
-- put me
-- put framenumber
set frame = getat (anim, framenumber)
set gap = getpropat (anim, framenumber)
-- put frame
-- mtest timetest, gap
set spritecount = count (frame)
-- put spritecount
repeat with spriteindex = 1 to spritecount
set drawindex = getpropat ( frame, spriteindex )
set draw = getat ( drawlist, drawindex )
set atomlist = getat ( frame, spriteindex )
set atomcount = count ( atomlist )
-- put spriteindex , atomlist
repeat with atomindex = 1 to atomcount
set data = getat ( atomlist , atomindex )
case ( getpropat ( atomlist , atomindex ) ) of
#hit:
-- put "hit!"
mhit callback, data
#offset:
-- put "offset"
msetoffset draw, data
#cast:
-- put "cast"
msetcastnumber draw, data
#finish:
-- put "finish"
mfinish me
return false
end case
end repeat
mdraw draw
end repeat
-- put "out manimate anim"
return gap
end manimate
-- =============================================================================
-- manimate method
-- -----------------------------------------------------------------------------
on mshow me
put "in mshow anim"
repeat with index = 1 to max
set draw = getat ( drawlist, index )
put draw
puto draw
end repeat
put "out mshow anim"
end mshow
-- =============================================================================
-- draw class patch batch methods
-- =============================================================================
-- msetloc method
-- -----------------------------------------------------------------------------
on msetloc me, theloc
-- put "in msetloc anim batch patch"
repeat with index = 1 to drawcount
set draw = getat ( drawlist, index )
msetloc draw, theloc
end repeat
-- put "out msetloc anim batch patch"
end msetloc
-- ==================================================
-- msetoffset method
-- --------------------------------------------------
on msetoffset me, theloc
-- put "in msetoffset anim batch patch : " , theloc
repeat with index = 1 to max
set draw = getat ( drawlist, index )
msetoffset draw, theloc
end repeat
end msetoffset
-- ==================================================
-- mmove method
-- --------------------------------------------------
on mmove me, theloc
-- put "in mmove anim batch patch : " , theloc
repeat with index = 1 to drawcount
set draw = getat ( drawlist, index )
mmove draw, theloc
end repeat
end mmove
-- ==================================================
-- mhide method
-- --------------------------------------------------
on mhide me
-- put "in mhide anim batch patch: "
repeat with index = 1 to drawcount
set draw = getat ( drawlist, index )
mhide draw
end repeat
-- put "out mhide anim batch patch: "
end mhide
-- ==================================================
-- mdraw method
-- --------------------------------------------------
on mdraw me
-- put "in mdraw anim batch patch"
repeat with index = 1 to max
set draw = getat ( drawlist, index )
mdraw draw
end repeat
end mdraw
-- ==================================================
-- msetcast method
-- --------------------------------------------------
on msetcast me, thecast
put "in msetcast anim batch patch: " , thecast
repeat with index = 1 to max
set draw = getat ( drawlist, index )
msetcast draw, thecast
end repeat
end msetcast me